<?php if (!defined("_ECRIRE_INC_VERSION")) return;

/**
 *  Dymanic Tag wich outputs product currency sign according to product's currency
 *  Format: #ECATALOGUE_PRODUCT_CURRENCY{<id_article[, <sign>]}
 *      If you want to output sign_pre, veale <sign> empty
 */

function balise_ECATALOGUE_PRODUCT_CURRENCY_SIGN($p) {	
	return calculer_balise_dynamique($p,'ECATALOGUE_PRODUCT_CURRENCY_SIGN', array());
}

function balise_ECATALOGUE_PRODUCT_CURRENCY_SIGN_stat($args, $filtres) {    
	return $args;
}

function balise_ECATALOGUE_PRODUCT_CURRENCY_SIGN_dyn($id_article, $sign = 'sign_pre') { 
    require_once(_DIR_PLUGIN_ECATALOGUE.'classes/class.CurrencyModel.php');
    $currency_mdl = new CurrencyModel();
    
    // If some exceptions are thrown - return empty value 
    try {        
		$sign = $currency_mdl->GetCurrencySignByIdArticle($id_article, $sign);
    } catch (Exception $e) {
        $sign = '';
    } 
    
    include_spip('inc/filtres');
    
    $sign = extraire_multi($sign);
    
    return array('balise/ecatalogue_product_currency_sign', 0, 
		array('sign' => $sign            
    ));
}

?>